//
//  HXMineView.m
//  Number To English
//
//  Created by 朱志雄 on 2024/7/23.
//
#define RGBACOLOR(r,g,b,a) [UIColor colorWithRed:(r)/255.0 green:(g)/255.0 blue:(b)/255.0 alpha:(a)]
#import "HXMineView.h"

@interface HXMineView ()

@property(nonatomic,weak) UIButton *titleBtn;
@property(nonatomic,weak) UIButton *arrow;

@end


@implementation HXMineView


-(instancetype)initWithFrame:(CGRect)frame{
    
    self = [super initWithFrame:frame];
    
    if (self) {
        
        UIButton *titleBtn = [UIButton buttonWithType:UIButtonTypeCustom];
        [titleBtn setImage:[UIImage imageNamed:@"info"] forState:UIControlStateNormal];
        [titleBtn setUserInteractionEnabled:NO];
        [titleBtn setTitleColor:RGBACOLOR(21, 21, 21, 1) forState:UIControlStateNormal];
        self.titleBtn = titleBtn;
        [titleBtn setTitle:@"info" forState:UIControlStateNormal];
        titleBtn.titleLabel.font = [UIFont fontWithName:@"PingFangSC-Regular" size:18];
        [titleBtn setContentHorizontalAlignment:UIControlContentHorizontalAlignmentLeft];
        titleBtn.imageEdgeInsets = UIEdgeInsetsMake(0, -12, 0, 12);
        [self addSubview:titleBtn];
        
        
        
        UIButton *arrow = [UIButton buttonWithType:UIButtonTypeCustom];
        self.arrow = arrow;
        [arrow setImage:[UIImage imageNamed:@"arrow"] forState:UIControlStateNormal];
        [arrow setUserInteractionEnabled:NO];
        [self addSubview:arrow];
        
        
        
    }
    return self;
}

-(void)layoutSubviews{
    [super layoutSubviews];
    
    
    self.titleBtn.frame = CGRectMake(25, 10, 200, 30);
    self.arrow.frame = CGRectMake(self.bounds.size.width - 36, 10, 30, 30);
}

-(void)setDict:(NSDictionary *)dict{
    
    _dict = dict;
    
    
    [self.titleBtn setImage:[UIImage imageNamed:dict[@"image"]] forState:UIControlStateNormal];
    [self.titleBtn setTitle:dict[@"title"] forState:UIControlStateNormal];
    
}


@end
